<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\Log;

class NoticeJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    protected $msg;
    /**
     * 初始化
     */
    public function __construct($msg)
    {
        $this->msg = $msg;
    }

    /**
     * Execute the job.
     * 执行任务
     *
     */
    public function handle()
    {
        if($this->msg==0){
            echo '当前时间---'.microtime_float();
            Log::info("================我是队列任务===============".'当前时间---'.microtime_float());
        }
        //用户数据
        echo "我在消费任务-----".$this->msg."\t".date("Y-m-d H:i:s")."\n";
        if($this->msg==99){
            echo '现在时间---'.microtime_float();
            Log::info("================我是队列任务===============".'现在时间---'.microtime_float());
        }

    }
}
